// 接口
const baseUrl = `http://10.3.221.6:7001` //晶晶
// const baseUrl = `http://192.168.137.120:7001` //晶晶（热点）
// const baseUrl = `http://10.3.221.22:7001`  //建
// const baseUrl = `http://10.3.221.9:7001`   //凤
// const baseUrl = `http://127.0.0.1:7001`   //鸽
// const baseUrl = `http://10.3.221.22:7001`//豪

function request(config) {
    // config url,method,data,params
    const {
        url,
        method = 'post',
        data = {},
        query = {}
    } = config
    // console.log( url,method,data,query)
    // 等待
    return new Promise((resolve, reject) => {
        wx.request({
            url: `${baseUrl}${url}`,
            method,
            data,
            query,
            success: (res => {
                resolve(res)
            }),
            fali: (err => {
                reject(err)
            })
        })
    })
}



module.exports = request